package com.hamll.es.config;


import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration//告诉Spring这是一个配置类
public class RestHighLevelClientConfig {

    //将es的域名告诉Spring
    @Bean
    public RestHighLevelClient restClient(){
        RestHighLevelClient restHighLevelClient =new RestHighLevelClient(
                RestClient.builder(HttpHost.create("http://192.168.229.142:9200")));
        return restHighLevelClient;
    }

}
